#include <bits/stdc++.h>
using namespace std;
// Savani004 //
#define ll long long int
#define float long double
#define fon for(ll i=0;i<n;i++)
#define f(i,x,n) for(ll i=x;i<n;i++)
#define rf(i, x, n) for (ll i = x; i >= n; i--)
#define fr(i,m) for(auto &i:m)
#define vl vector<ll>
#define mll map<ll,ll>
#define mcl map<char,ll>
#define vpl vector<pair<ll,ll>>
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rtn return
#define fi first
#define se second
#define M 1000000007
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#ifndef ONLINE_JUDGE
#include "debug.hpp"
#else
#define debug(...) 42
#endif
ll gcd(ll a,ll b){if(b==0){return a;}return gcd(b,a%b);}
ll lcm(ll a,ll b){return (a/gcd(a,b))*b;}
const ll N = 1e6;vector<bool> is_prime(N, 1);vl prime;void PRIME(){for (ll i = 2; i <= N; i++){if (is_prime[i]){prime.pb(i);for (ll j = i * 2; j <= N; j += i)is_prime[j] = 0;}}}
ll powerM(ll x,ll y){ll dd=1;x=x%M;if(x==0){return 0;} while(y>0){if(y&1)dd=(dd*x)%M;y=y>>1;x=(x*x)%M;}return dd;}
ll powerr(ll n,ll a){ ll res=1; while(a){ if(a%2){ res*=n,a--;}else{n*=n,a/=2;}} return res;}
ll fastprime(ll a){if(a==2){return 1;}if (a%2==0 || a<=1) return 0;int bo = (int)floor(sqrt(a)); for(int i = 3; i <= bo; i += 2) if(a % i == 0) return 0; return 1;}
ll n,m,i,j,p,q,r,a,b,x,y,sum,cnt,ans,res,k,d,dd,ddd,mx,mn,flg,low,mid,high,tmp,temp;
void solve(){
cin>>n;
vector<string> v(n);
fon{
cin>>v[i];
}
ans=0;
for(char i='a';i<='z';i++){
for(char j='a';j<='z';j++){
cnt=0;
f(k,0,n){
flg=0;
f(l,0,v[k].length()){
if(v[k][l]!=i && v[k][l]!=j){flg=1;break;}
}
if(flg==0)cnt+=v[k].length();
}
ans=max(ans,cnt);
}
}
cout<<ans<<endl;
}
int main()
{
fast;
//int t;cin>>t;while(t--)
solve();
return 0;
}
WLDRPL Wildcard Replacement | 1221. Split a String in Balanced Strings |
1002. Find Common Characters | 1602A - Two Subsequences |
1555A - PizzaForces | 1607B - Odd Grasshopper |
1084A - The Fair Nut and Elevator | 1440B - Sum of Medians |
1032A - Kitchen Utensils | 1501B - Napoleon Cake |
1584B - Coloring Rectangles | 1562B - Scenes From a Memory |
1521A - Nastia and Nearly Good Numbers | 208. Implement Trie |
1605B - Reverse Sort | 1607C - Minimum Extraction |
1604B - XOR Specia-LIS-t | 1606B - Update Files |
1598B - Groups | 1602B - Divine Array |
1594B - Special Numbers | 1614A - Divan and a Store |
2085. Count Common Words With One Occurrence | 2089. Find Target Indices After Sorting Array |
2090. K Radius Subarray Averages | 2091. Removing Minimum and Maximum From Array |
6. Zigzag Conversion | 1612B - Special Permutation |
1481. Least Number of Unique Integers after K Removals | 1035. Uncrossed Lines |